package ru.aptu.gsp_banking.dao_impl;

import org.hibernate.SessionFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
import ru.aptu.gsp_banking.dao.CurrencyInfoDAO;
import ru.aptu.gsp_banking.domain.Currency;
import ru.aptu.gsp_banking.domain.CurrencyInfo;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.List;

/**
 * Created by IntelliJ IDEA.
 * User: alex
 * Date: 12/21/11
 * Time: 2:51 PM
 */

@Repository
public class CurrencyInfoDAOImpl implements CurrencyInfoDAO {

    @Autowired
    private SessionFactory sessionFactory;

    public CurrencyInfo getCurrencyInfo() {
        return (CurrencyInfo) sessionFactory.getCurrentSession().createQuery("from CurrencyInfo").uniqueResult();
    }

    public void updateCurrencyInfo(CurrencyInfo currencyInfo) {
        sessionFactory.getCurrentSession().update(currencyInfo);
    }
}
